<%@include file="../context.jsp"%>
<form:form method="POST" id="form_id" commandName="criteria"
	action="${pageContext.request.contextPath}/admin/${param.page}/search.html">
	<form:input cssClass="datepicker" path="fromDate" id="fromDatepicker" />
	<form:input cssClass="datepicker" path="toDate" id="toDatepicker" />
	<form:input onselect="" cssClass="searchSelector"
		list="companyNameList" path="companyName" />
	<input id="search_btn" class="btnSerch btn-info" type="submit"
		value="Search" />
	<input id="reset_btn" class="btnSerch btn-info" type="button"
		value="Reset" />
</form:form>
<jsp:include page="common_link.jsp" />
<datalist id="companyNameList">
	<c:forEach items="${companyMap}" var="company">
		<option value="${company.name}"></option>
	</c:forEach>
</datalist>

<script type="text/javascript">
	$(document)
			.ready(
					function() {
						$("#reset_btn").on(
								"click ",
								function() {
									$(".datepicker").val("");
									$(".searchSelector").val("");
									if ($('.datepicker').is(':empty')
											&& $('.searchSelector')
													.is(':empty')) {
										$("#form_id").submit();
									}

								});

						$('#clearCacheLink')
								.click(
										function(e) {
											if (confirm("Are you sure you want to clear the caches ? Once done, this operation cannot be undone")) {
												document.location = "/StockScreener/clear_cash";
												$("#loading").fadeIn();
											}
										});
						/* $("#search_btn").on("click ", function() {
							comId = $("input[name=txtCompanyName]").val();
							$(".comapny_id").val(comId);
						});

						$("#companyName").on("change ", function() {
							comId = $("#companyNameList").val();
							$(".comapny_id").attr("value", comId);
						});
 */
					});
</script>

